<?php
require_once "php/Context.php";
require_once "php/AdminInit.php";

$username = isset($_POST['login']) ? $_POST['login'] : false;
$password = isset($_POST['password']) ? $_POST['password'] : false;
$logout = isset($_GET['logout']) ? $_GET['logout']  : false;

if($username && $password)
{
    $admin->login($username,$password);

}

if($logout)
{
    $admin->logout();
    $session->closeSession();
    echo "<script>document.location.href='/Panel/AdminPanel.php';</script>";
}

if($admin->isAuthorize())
{
    $session->closeSession();
    echo "<script>document.location.href='/Panel/AdminPanel.php';</script>";
}



?>

<?php
echo "<img src=\"http://localhost/HC/images/$image\" />"
?>



<!DOCTYPE html>
<html lang="en">
<head>
    <title>Admin</title>
    <meta charset="utf-8">
    <link rel="stylesheet" href="../custom-site/css/style.css" type="text/css" media="all">
    <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css" media="all">
    <style>
        .login_form{
            margin: 0 auto;
            left: 300px;
            top:30px;
        }
    </style>
</head>
<body>
<form method="post">
   <div class="container">
       <div class="row">
           <div class="col-md-5 login_form">
               <div class="form-group">
                   <label for="exampleInputEmail1">Login:</label>
                   <input type="text" class="form-control" name="login"  placeholder="Enter login">
               </div>
               <div class="form-group">
                   <label for="exampleInputPassword1">Password:</label>
                   <input type="password" class="form-control" name="password"  placeholder="Password">
               </div>

               <button type="submit" class="btn btn-default">Submit</button>
           </div>
       </div>
   </div>
</form>
</body>
</html>

